<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<c:set var="url" value="${pageContext.request.contextPath}/" />
<link rel="stylesheet" href="${url }plugins/select2/select2.min.css">
<script src="${url }plugins/select2/select2.full.min.js"></script>
<script type="text/javascript">
$(function() {
	init();
});

function init(){
	var addIp =$("#addIp").val();
	$.ajax({
		type:"POST",
		url: path+'collect/getBeatInfo',
		data:{ip:addIp,beatName:'ptsyslogbeat'},
		success: function(result){
			$("#target").val(result.result.ptsyslogbeat.parameter.values.LOGSTASH_SYSLOGHOST_IP);
		}
	}); 
}

function addBeat(){
	$.ajax({
		type:"POST",
		url: path+'collect/addPtSyslogBeat',
		data:{ip:$("#target").val(),targetIp:$("#addIp").val()},
		success: function(result){
			if(result){
				alert("提交成功");
			}
		}
	}); 
}
</script>
<div class="box box-info">
	<div class="box-header with-border">
		<h3 class="box-title">PtSyslogBeat / </h3>
		<!-- /.box-tools -->
	</div>
<!-- /.box-header -->
  <div class="box-body form-horizontal">
  	<div class="form-group">
       <label for="inputEmail3" class="col-sm-2 control-label">转发目标</label>
      <div class="col-sm-3">
        <input id="target" type="text" class="form-control"  placeholder="转发目标">端口默认为5514
      </div>
    </div>
     <div class="box-footer">
       <a type="submit" class="btn btn-info" onclick="addBeat()">提交</a>
       <a href="javascript:linkByDom('local-list','${url }collect/getBeatList');" class="btn btn-default">取消</a>
    </div>
  </div>
</div>
	<input type="hidden" value="${ip }" id="addIp" />		            
